home *** CD-ROM | disk | FTP | other *** search
- Path: news.kth.se!news
- From: Anders Olsson <aolsson@ce.kth.se>
- Newsgroups: comp.lang.c++
- Subject: Vector of abstract classes using STL
- Date: Mon, 22 Jan 1996 11:40:26 +0100
- Organization: BKN, KTH
- Message-ID: <3103699A.79F8@ce.kth.se>
- NNTP-Posting-Host: zodiac.ce.kth.se
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (X11; I; SunOS 5.4 sun4m)
-
- I'm new to STL and have a question about vectors.
-
- I have an abstract class Shape, that has pure virtual functions.
- From this class I derive rectangle and circle classes.
- I want to use a vector for storing the shapes.
-
- I've tried using a vector<Shape>, but I get compiler errors because
- the Shape class cannot be instantiated. This must be the wrong way of
- doing it I understand.
-
- I think I have to use a vector<Shape*> but does the vector delete
- the shape elements when the program finishes?
-
- ---
- Anders Olsson
- Stockholm, Sweden
-